From ae4bef68014eb7b2dafba3e84c5ee61b0ff6cbb3 Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 14 Nov 2002 05:16:05 +0000 Subject: [PATCH] Add rtrim to trim those scanf'ed things with all the trailing whitespace. csv_stringtrim isn't quite what we need... --- gpsbabel/gpsutil.c | 1 + gpsbabel/util.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gpsbabel/gpsutil.c b/gpsbabel/gpsutil.c index 6d0dc3e28..42fb4dbb9 100644 --- a/gpsbabel/gpsutil.c +++ b/gpsbabel/gpsutil.c @@ -55,6 +55,7 @@ data_read(void) while( fscanf(file_in, "%s %le%c %le%c %ld%c %30[^,] %c", name, &lat, &latdir, &lon, &londir, &alt, &alttype, desc, icon) > 0) { + rtrim(desc); wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); wpt_tmp->position.altitude.altitude_meters = alt; wpt_tmp->shortname = xstrdup(name); diff --git a/gpsbabel/util.c b/gpsbabel/util.c index 190920290..2a581c74f 100644 --- a/gpsbabel/util.c +++ b/gpsbabel/util.c @@ -59,6 +59,23 @@ xstrdup(const char *s) return o; } +void * +rtrim(char *s) +{ + char *p; + + while (*s) { + s++; + } + + s--; + while (isspace (*s)) { + *s = 0; + s--; + } + +} + coord mkposn(const char *string) -- 2.30.2